import request from '@/utils/request'

/**
 * 获取设备信息
 */
export const getEquipmentList = (data) => {
  return request({
    url: '/vm-service/vm/search',
    params: data
  })
}

/**
 * 售货机类型列表(搜索)
 */
export const getEquipmenTypetList = (data) => {
  return request({
    url: '/vm-service/vmType/search',
    params: data
  })
}

/**
 * 点位搜索
 */
export const getOrderList = (data) => {
  return request({
    url: '/vm-service/node/search',
    params: data
  })
}

/**
 * 商品搜索
 */
export const getGoodsList = (params) => {
  return request({
    url: '/vm-service/sku/search',
    params
  })
}

/**
 * 新增售货机
 */
export const addEquipment = (data) => {
  return request({
    url: '/vm-service/vm',
    method: 'post',
    data
  })
}

/**
 * 修改售货机点位
 */
export const editEquipment = (id, nodeId) => {
  return request({
    url: `/vm-service/vm/${id}/${nodeId}`,
    method: 'put'
  })
}

/**
 * 售货机类型详情
 */
export const getequipmentList = (typeId) => {
  return request({
    url: `/vm-service/vmType/${typeId}`
  })
}

/**
 * 获取售货机货道详情
 */
export const getequipmentDetail = (innerCode) => {
  return request({
    url: `/vm-service/channel/channelList/${innerCode}`
  })
}

/**
 * 新增售货机类型
 */
export const addequipmentType = (data) => {
  return request({
    url: '/vm-service/vmType',
    method: 'post',
    data
  })
}

/**
 * 售货机类型修改
 */
export const editequipmentType = (typeId, data) => {
  return request({
    url: `/vm-service/vmType/${typeId}`,
    method: 'put',
    data
  })
}

/**
 * 售货机类型详情
 */
export const equipmentTypeDetail = (typeId) => {
  return request({
    url: `/vm-service/vmType/${typeId}`,
    method: 'get'
  })
}

/**
 *
 */
export const changeConfiguration = (channelList, innerCode) => {
  return request({
    url: '/vm-service/channel/channelConfig',
    method: 'PUT',
    data: {
      channelList,
      innerCode
    }
  })
}
